/**
 * 正则表达式
 */
export const Regs = {
    // 身份证
    ID_CARD: /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/,
    // 手机号
    PHONE: new RegExp(/^1(3|4|5|6|7|8|9)\d{9}$/, 'g'),
    // 座机（传真）
    // LANDLINE: /0\d{2,3}-\d{7,8}-\d{1,6}/,
    LANDLINE: /0\d{2,3}\d{7,8}\d{1,6}/,
}

/**
 * 正则表达式
 */
export const FIELD_RULES = {
    // 姓名校验(2到25位中文字符 + `·`)
    NAME: { pattern: /^[\u4e00-\u9fa5·]{2,25}$/, message: '请输入正确的姓名格式' },
    PHONE: { pattern: /^1(3|4|5|6|7|8|9)\d{9}$/, message: '请输入正确的手机号格式' },
    // PHONE: { pattern: /^\d{7,13}$/, message: '请输入正确的手机号格式' },
    ID_CARD: {
        pattern: /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/,
        message: '请输入正确的身份证格式',
    },
}

export const PWD_RULES = [
    { required: true, message: '密码必填' },
    { pattern: /^\S*$/, message: '请输入正确的密码' },
    { pattern: /^.{8,20}$/i, message: '密码长度8-20位' },
    {
        pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[\s\S]{8,20}$/,
        message: '必须包含大小写字母、数字',
    },
]

/** 包含特殊字符的强密码规则 */
export const PWD_HARD_RULES = [
    { pattern: /^.{8,20}$/i, message: '密码长度8-20位' },
    {
        pattern: /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*()_\-+=<>?,.]).{8,20}$/,
        message: '必须包含字母、数字、特殊字符',
    },
]
